<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body th:inline="text">
<table border="1">
    <thead>
    <tr>
        <th >编号</th>
        <th >店名</th>
        <th >店铺所在城市</th>
        <th >店铺描述</th>
        <th >审核状态</th>
        <th >删除状态</th>
        <th >店主ID</th>
        <th >店铺申请时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <tr th:each="store: ${stores}">
        <td th:text="${store.storeId}"></td>
        <td th:text="${store.storeName}"></td>
        <td th:text="${store.storeCity}"></td>
        <td th:text="${store.storeDescription}"></td>
        <td th:text="${store.storeState}"></td>
        <td th:text="${store.storeIsdel}"></td>
        <td th:text="${store.userId}"></td>
        <td th:text="${store.storeCreatetime}"></td>

        <td><a th:href="'store/updateStore?storeId='+${store.storeId}">修改</a>
            <a th:href="'store/delStore?storeId='+${store.storeId}">删除</a>
            <a th:href="'store/showallbyuid?userId='+${store.userId}">查找</a>
            <a th:href="'store/addProduct?storeId='+${store.storeId}+'&userId='+${store.userId}">添加商品</a>
        </td>
    </tr>
    <tr>
        <td >其他：</td>
        <td ><a th:href="'addStore?'">增加</a> </td>
        <td><label>输入店主id：</label><input  id="temp"><button th:onclick="searchbyuid()">查找</button></td>
        <td><label>输入店名关键字:</label><input id="temp2"><button th:onclick="searchbyname()">查找</button> </label></td>
        <td><label>输入店铺所在城市:</label><input id="temp4"><button th:onclick="searchbycity()">查找</button> </td>
        <td><a th:href="'store/searchallStore'" >查找全部</a></td>
    </tr>
    </tbody>
</table>
<script>
    function searchbyuid() {
        var temp1=document.getElementById("temp").value;
        console.log(temp1);
        window.location.href='store/showallbyuid?userId='+temp1;
    }
    function searchbyname() {
        var temp3=document.getElementById("temp2").value;
        console.log(temp3);
        window.location.href='store/showallbyname?storeName='+temp3;
    }
    function searchbycity() {
        var temp5 = document.getElementById("temp4").value;
        console.log(temp5);
        window.location.href='store/showallbycity?storeCity='+temp5;
    }
</script>
</body>
</html>